// pages/mathhome/mathhome.js
// pages/index/index.js

Page({ 
    data: {
        pickerVisible: false,
        sel: ['一年级', '二年级', '三年级'],
        multiArray: [['一年级', '二年级', '三年级'], ['5', '10', '20']],
        multiIndex: [0, 0],
        testIds: ['math1','math2','math3'],
        selectedTestId: ''
    },
    showPicker: function() {
        this.setData({
          pickerVisible: true
        });
      },
      onMultiChange: function(e) {
        const index = e.detail.value;
        const selectedGrade = this.data.testIds[index[0]];
        const selectedNum = this.data.multiArray[1][index[1]];
        this.setData({
          pickerVisible: false 
        });
      
        wx.navigateTo({
          url: `../math1/math1?testId=${selectedGrade}&number=${selectedNum}`
        });
      },
    toTestPage: function(e){
        let testId = e.currentTarget.dataset['testid'];
        wx.navigateTo({
          url: '../math1/math1?testId='+testId
        })
    },
    goToPage2: function() {
      wx.navigateTo({
        url: '/packageM/pages/fav/fav'
      });
    },
  
    goToPage3: function() {
      wx.navigateTo({
        url: '/packageM/pages/wrong/wrong'
      });
    }
  });